%
% `SGMagVar.tex' -- describes the magnetic variation functions
%
%  Written by Curtis Olson.  Started July, 2000.
%
% $Id: SGMagVar.tex,v 1.1.1.1 2002/09/07 02:58:21 curt Exp $
%------------------------------------------------------------------------


\documentclass[12pt]{article}

\usepackage{anysize}
\papersize{11in}{8.5in}
\marginsize{1in}{1in}{1in}{1in}

\usepackage{amsmath}

\usepackage{epsfig}

\usepackage{setspace}
\onehalfspacing

\usepackage{url}


\begin{document}


\title{
    SimGear \texttt{SGMagVar} class.
}


\author{
    Edward A Williams (\texttt{Ed\_Williams@compuserve.com}) \\
    Wrapper class by Curt Olson (\texttt{curt@flightgear.org})
}


\maketitle


\section{Introduction}

The \texttt{SGMagVar} class calculates the magnetic variation and dip
for any position, altitude, and time.  It is a complete
re-implimentation of the NIMA WMM 2000 (not derived from their demo
code.)

\section{Synopsis}

\begin{verbatim}
#include <simgear/magvar/magvar.hxx>

SGMagVar mag;
\end{verbatim}


\section{\texttt{SGMagVar}}

The \texttt{SGMagVar} class is really a simple wrapper around the core
Ed Williams code which does all the hard work.  This class allows you
to crunch the math once and then do multiple polls of the data.
However, if your position, altitude, or time changes significantly,
you should call the \texttt{update()} method to recrunch new numbers.

\subsection{Constructor}

\begin{verbatim}
SGMagVar mag;
\end{verbatim}

This creates an instance of the \texttt{SGMagVar} object.  You must
call the \texttt{update()} method before any queries will be valid.

\subsection{Periodic Updates}

\begin{verbatim}
// recalculate the magnetic offset and dip
void update( double lon, double lat, double alt_m, double jd );
\end{verbatim}

The \texttt{update()} method requires you to pass in your position and
the julian date.  Lon and lat are specified in radians, altitude is
specified in meters.  Julian date can be conveniently calculated by
using an instance of the \texttt{SGTime} class.

\section{Accessor Methods}

Once an instance of \texttt{SGMagVar} has been successfully updated,
you may access valid data from it.

\begin{verbatim}
double get_magvar();
\end{verbatim}

Returns the magnetic variation in radians.

\begin{verbatim}
double get_magdip();
\end{verbatim}

Returns the magnetic dip in radians.


\end{document}
